#ifndef VIDEO_H
#define VIDEO_H

#include<QMessageBox>
#include <QObject>
#include <QThread>
#include <QMutex>
#include <QImage>
#include <QMutex>
#include <stdio.h>
#include <stdlib.h>
#include <QFile>
#include <QTextStream>

#include <opencv/cxcore.h>
//#include <opencv/highgui.h>
#include <opencv/opencv2/imgproc/include/opencv2/imgproc/imgproc.hpp>
#include <opencv/cv.h>

#include <stdio.h>
#include <iostream>
#include <opencv/opencv2/core/include/opencv2/core/core.hpp>
#include <opencv/opencv2/highgui/include/opencv2/highgui/highgui.hpp>
#include <opencv/opencv2/calib3d/include/opencv2/calib3d/calib3d.hpp>
#include <opencv/opencv2/features2D/include/opencv2/features2D/features2D.hpp>

using namespace cv;

#include <math.h>
static const double pi = 3.14159265358979323846;
inline static double square(int a)
{
return a * a;
}



class video:public QThread
{
Q_OBJECT
public:
    Mat img_object[1000];
 QImage IplImage2QImage( Mat);
void load_cam();
video();
~video();
void end();
int image;
bool see_descriptor;
bool running;
double ratiomin;
public slots:
void run();
private:
std::vector<KeyPoint> keypoints_object[1000];
Mat descriptors_object[1000];

SurfFeatureDetector detector,detectorinit;
SurfDescriptorExtractor extractor,extractorinit;

QMutex mutex;
CvCapture *avi;

signals:
void match(double);
void result(int);

void video_updated(QImage );
};

#endif // VIDEO_H
